﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace THEMXOASUA
{
    class HOADON
    {
        private HOADONDAL dal = new HOADONDAL();
        public HOADON()
        {

        }
        public DataTable DanhSachHoaDon()
        {
            DataTable DT = dal.DOCDANHSACHHoaDon();
            return DT;
        }
        public void XOAHOADON(string sohd)
        {
            dal.XOAHOADON(sohd);
        }
        public void THEMHOADON(string sohd, string mahang, double soluong, double dongia, string diengiai)

        {
            double tg = soluong * dongia;
            double km= 0.0;
            if (tg > 20000000)
                km = (tg* 5) / 100;
            else
                km = 0.0;
            dal.THEMHOADON(sohd,mahang,soluong,dongia,tg,km,diengiai);

        }
        public void LuuHoaDon(string sohd, string mahang, double soluong, double dongia, string diengiai)
        {
            double trigia = soluong * dongia;
            double khuyenmai = 0.0;
            if (trigia > 20000000)
                khuyenmai = (trigia * 5) / 100;
            else
                khuyenmai = 0.0;
            dal.THEMHOADON(sohd, mahang, soluong, dongia, trigia, khuyenmai, diengiai);

          
        }


        public void SUAHOADON(string shd,string sohd, string mahang, double soluong, double dongia,  string diengiai)
        {
            double trigia = soluong * dongia;
            double khuyenmai = 0.0;
            if (trigia > 20000000)
                khuyenmai = (trigia * 5) / 100;
            else
                khuyenmai = 0.0;
            dal.SUAHOADON(shd,sohd, mahang, soluong, dongia, diengiai);
        }
    }
}
